<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateHistoriesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('histories', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer("child_id")->comment("学生/学生表id");
            $table->integer("game_id")->comment("项目id");
            $table->integer("grade_id")->comment("项目等级id");
            $table->integer("category_id")->comment("项目分类id");
            $table->integer("level")->default(-1)->comment("游戏难度等级");
            $table->integer("agency_id")->comment("机构表id");
            $table->integer("device_id")->comment("设备表id");
            $table->dateTime("start_time")->comment("本次训练本项目开始时间");
            $table->dateTime("end_time")->comment("本次训练本项目完成时间");
            $table->integer("use_time")->comment("使用时间");
            $table->integer("start_star")->comment("本次训练开始时星星等级");
            $table->integer("end_star")->comment("本次训练完成时星星等级");
            $table->tinyInteger("result")->default(0)->comment("本次训练是否通关");
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('histories');
    }
}
